﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UserControls
{
    public partial class ConnectionStrSettingsUC : UserControl
    {
        private string serverName;
        private string databaseName;
        private string password;
        private string username;

        public string Username
        {
            get { return username; }
            set { username = value; }
        }

        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        public string DatabaseName
        {
            get { return databaseName; }
            set { databaseName = value; }
        }

        public string ServerName
        {
            get { return serverName; }
            set { serverName = value; }
        }

        public ConnectionStrSettingsUC()
        {
            InitializeComponent();
        }

        private void SetValues()
        {
            this.serverName = textBoxServerName.Text;
            this.databaseName = textBoxDatabaseName.Text;
            this.username = textBoxUsername.Text;
            this.password = textBoxPassword.Text;
        }

        public string GetConnectionString()
        {
            SetValues();
            string connectionStr = @"Server=" + this.serverName + @"; Database=" + this.databaseName + @"; User=" + this.username + @"; Password=" + this.password;
            return connectionStr;
        }
    }
}
